import request from '@/utils/request'

// 查询资讯列表
export function listInformation(query) {
  return request({
    url: '/operation-center/information/list',
    method: 'get',
    params: query
  })
}

// 查询资讯详细
export function getInformation(id) {
  return request({
    url: '/operation-center/information/' + id,
    method: 'get'
  })
}

// 新增资讯
export function addInformation(data) {
  return request({
    url: '/operation-center/information',
    method: 'post',
    data: data
  })
}

// 修改资讯
export function updateInformation(data) {
  return request({
    url: '/operation-center/information',
    method: 'put',
    data: data
  })
}

// 批量上下架
export function batchUpdateSellStatus(ids, status, data) {
  return request({
    url: `/operation-center/information/${ids}/${status}`,
    method: 'put',
    data: data
  })
}

// 删除资讯
export function delInformation(id) {
  return request({
    url: '/operation-center/information/' + id,
    method: 'delete'
  })
}

// 编辑器上传图片
export function uploadImage(data) {
  return request({
    url: '/operation-center/information/uploadImageForWangEditor',
    method: 'post',
    data: data
  })
}

// 删除banner
export function deleteNewsImg(id) {
  return request({
    url: '/operation-center/information/rmCover/'+id,
    method: 'delete',
  })
}

// 切换排序值
export function replaceOrderNo(id1, id2) {
  return request({
    url: `/operation-center/information/replaceOrder/${id1}/${id2}`,
    method: 'put',
  })
}

// 设置排序值
export function setOrderNo(order1, order2) {
  return request({
    url: `/operation-center/information/setOrder/${order1}/${order2}`,
    method: 'put',
  })
}

